package com.homegoods.designer.item;

import android.view.View;

import com.homegoods.classify.model.Constant;
import com.homegoods.designer.R;
import com.homegoods.designer.model.DesignerCaseModel;
import com.kedll.library.adapter.MultiTypeAdapter;
import com.kedll.library.mvp.BaseItem;

/**
 * @author QiQi
 * @ClassName: DesignerCaseItem
 * @date 2018/9/15
 * @description
 */
public class DesignerCaseItem extends BaseItem<DesignerCaseModel> {
    private final int type;

    public DesignerCaseItem(int type, DesignerCaseModel data, MultiTypeAdapter adapter) {
        super(data);
        this.type = type;
        setOnClickListener(v -> {
            if (adapter.getOnItemClickListener() != null) {
                adapter.getOnItemClickListener().onItemClicked(v, this);
            }
        });
    }


    public String getImgUrl() {
        return Constant.SERVER_URL + getData().getBgimg();
    }

    public String getTitle() {
        return getData().getTitle();
    }

    public String getHouseType() {
        return getData().getHuxing();
    }

    public String getSpace() {
        return getData().getMianji();
    }

    public int getVisibility() {
        return type == 1 ? View.VISIBLE : View.GONE;
    }

    @Override
    public int getLayout() {
        return R.layout.designer_item_case;
    }
}
